home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MATH.SWG / 0037_Complex Math.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  517b  |  22 lines

  1. {
  2. ROBERT ROTHENBURG
  3.  
  4. > Can you compute complex numbers and/or "i" in Pascal...if so, how.
  5.  
  6. Not too hard. I've done that With some fractal Programs, which were
  7. written For TP5 (it might be easier using OOP With the later versions).
  8.  
  9. I use two Variables For a complex number of a+bi, usually expressed as
  10. xa and xb (or x.a and x.b as a Record).
  11.  
  12. For addition/subtraction (complex z=x+y):
  13.  
  14.  z.a:=x.a+y.a;
  15.  z.b:=x.b+y.b;
  16.  
  17. For multiplication:
  18.  
  19.  z.a:=(x.a*y.a)-(x.b*y.b);
  20.  z.b:=(x.a*y.b)+(x.b*y.a);
  21. }
  22.